package com.vegetable.modules.entity.finance.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 客户回款预警设置VO
 * </p>
 *
 * @author vegetable
 * @since 2025-10-24
 */
@Data
@ApiModel(value = "CustomerCollectionAlertVO", description = "客户回款预警设置VO")
public class CustomerCollectionAlertVO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "客户ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long customerId;

    @ApiModelProperty(value = "客户名称")
    private String customerName;

    @ApiModelProperty(value = "回款预警天数（超过多少天未回款触发预警）")
    private Integer alertDays;

    @ApiModelProperty(value = "是否启用预警：0否1是")
    private Integer isEnabled;

    @ApiModelProperty(value = "预警级别：1轻微2严重3紧急")
    private Integer alertLevel;

    @ApiModelProperty(value = "预警级别名称")
    private String alertLevelName;

    @ApiModelProperty(value = "通知用户ID列表（逗号分隔）")
    private String notificationUserIds;

    @ApiModelProperty(value = "通知用户名称列表")
    private String notificationUserNames;

    @ApiModelProperty(value = "创建者ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createUserId;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @ApiModelProperty(value = "台账标识 0寿光 1河北 2聊城 3云南")
    private Integer regionId;

    @ApiModelProperty(value = "当前未回款订单数")
    private Integer unreceivedOrderCount;

    @ApiModelProperty(value = "当前预警订单数")
    private Integer alertOrderCount;

    /**
     * 获取预警级别名称
     */
    public String getAlertLevelName() {
        if (alertLevel == null) {
            return "";
        }
        switch (alertLevel) {
            case 1:
                return "轻微";
            case 2:
                return "严重";
            case 3:
                return "紧急";
            default:
                return "未知";
        }
    }
}
